package com.blast.comicsisland.model.game.gamebody;

/**
 * Created by dell on 2015/6/24.
 */

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.LinkedList;
import java.util.List;

/**
 * 游戏下部的ListView
 *
 GET http://mhjk.1391.com/comic/getapplicationlist?pageno=1&pagesize=20&sort=1&e=1435058018&grouptype=0&apptype=1&channelid=baidu
 */
public class GameBody {
    private String codeMsg;
    private String code;
    private List<Info> infos;

    public String getCodeMsg() {
        return codeMsg;
    }

    public void setCodeMsg(String codeMsg) {
        this.codeMsg = codeMsg;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public List<Info> getInfo() {
        return infos;
    }

    public void setInfo(List<Info> infos) {
        this.infos = infos;
    }

    //--------------------------------->
    //解析
    public void jsonParse(JSONArray jsonArray) {
        if (jsonArray != null) {
            infos = new LinkedList<Info>();
            for (int i = 0; i < jsonArray.length(); i++) {
                try {
                    JSONObject jsonObject = jsonArray.getJSONObject(i);
                    Info info = new Info();
                    info.jsonParse(jsonObject);
                    infos.add(info);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
